batch files

Batch files contain a sequence of DOS commands. By running the batch file, this sequence is run. This can be used to save time, so that a set of commands does not have to be typed out in full at the DOS prompt each time.

Batch files are text files, but with the .bat file extension. They can be created or edited with a text editor such as edit.

To run a batch file, simply type its name at the DOS prompt, with or without the .bat extension:

   c:\autoexec.bat
   foo
   foo.bat

A very important batch file, autoexec.bat, is run automatically when FreeDOS starts

Commands designed for batch files

Some commands are especially designed for use in programming batch files:
   beep       makes a beeping sound
   call       runs another batch file
   choice     prompts the user to make a choice
   echo       print a message, turn batch file display on/off
   for        for loop (repeat commands)
   goto       continue running from somewhere else in the batch file
   if         if condition (choose between two sets of commands)
   pause      waits for user to press a keyt
   rem        expanatory remarks for the programmer
   shift      shifts the numbering of batch file parameters

Copyright © 2003 Rob Platt
This file forms part of The FreeDOS HTML Help Documentation, and is covered under its terms: see index.htm